
import { Boolean, Code, Desc, Digdit, DisplayOrder, Entity, Jsonb, PrimaryUuid, Title, Uuid } from "@sker/core";

@Entity({ name: 'core_table' })
export class CoreTable {
    @PrimaryUuid()
    id: string;

    @Code({ label: '唯一名称' })
    name: string;

    @Title({ comment: '表格名称' })
    title: string;

    @Desc({ comment: '表格简介' })
    desc: string;

    @Code({ comment: '表格尺寸', default: 'middle' })
    size: string;

    @Uuid({ comment: '数据表' })
    entity_id: string;

    @Jsonb({ comment: '表格样式', default: {} })
    tableStyle: any;

    @Digdit({ comment: '防抖时间', default: 10 })
    debounceTime: number;

    @Boolean({ comment: '窗口聚焦时自动重新请求', default: true })
    revalidateOnFocus: boolean;
}

@Entity({
    name: 'core_table_column'
})
export class CoreTableColumn {
    @PrimaryUuid()
    id: string;

    @Uuid({ comment: '所属列表' })
    table_id: string;

    @Code({ comment: '列名' })
    dataIndex: string;

    @Title({ comment: '汉语名' })
    title: string;

    @Boolean({ comment: '超长隐藏', default: false })
    ellipsis: boolean;

    @Boolean({ comment: '可复制' })
    copyable: boolean;

    @Desc({ comment: '提示' })
    tooltip: string;

    @Boolean({ comment: '可排序' })
    sorter: boolean;

    @DisplayOrder({ label: '排序', default: 0 })
    display_order: number;

    @Jsonb({ label: '设置', default: {} })
    setting: any;
}
